<?php
/**
 * Created by PhpStorm
 * User: rain
 * Date: 2018/12/26
 * Time: 下午5:23
 */

namespace App\Models;

use App\User;
use Illuminate\Database\Eloquent\Model;


/**
 * Class Reports
 * @property integer $id
 * @property integer $user_id
 * @property integer $book_id
 * @property integer $book_chapter_id
 * @property string $en_word
 * @property string $opt_desc
 * @property string $other_desc
 * @property integer $status
 * @property string $mark
 * @property string $created_at
 * @property string $updated_at
 * @package App\Models
 */
class Reports extends Model
{
    protected $table = 'reports';

    protected $guarded = ['id'];

    const STATUS_NO  = 0;
    const STATUS_YES = 1;
    public static $statusLabels = [
        self::STATUS_NO => '未处理',
        self::STATUS_YES => '已处理',
    ];

    public function images()
    {
        return $this->hasMany(RoastImages::class,'roast_id','id');
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function book()
    {
        return $this->belongsTo(Book::class);
    }

    public function chapter()
    {
        return $this->belongsTo(BookChapter::class,'book_chapter_id','id');
    }


}
